package top.starmc.starpet.hook

import org.bukkit.entity.Player
import taboolib.platform.compat.PlaceholderExpansion
import top.starmc.starpet.util.getPlayerData

object Papi : PlaceholderExpansion {
    override val identifier: String = "StarPet"

    override val autoReload = true

    override fun onPlaceholderRequest(player: Player?, args: String): String {
        return player?.getPlayerData()?.run {
            if (args.equals("Exp", true)) {
                experience.toString()
            } else if (args.equals("Level", true)) {
                level.toString()
            } else {
                null
            }
        } ?: ""
    }
}